var ad_game = {
    bindEvent: function (){
        $(".list-table-body").on('click', '.table-operation', this.Operation);
    },
    Operation: function() {
        var _this = $(this),
            command = _this.attr("data-command"),
            args = _this.attr("data-command-args");
        if( command == 'state' ) ad_game.State(_this, args);
        if( command == 'modify' ) ad_game.Modify(_this, args);
        if( command == 'remove' ) ad_game.Remove(_this, args);
    },
    State: function(_this, args) {
        var _self = this;

    },
    Modify: function(_this, args) {
        var _self = this;
        PopModel.openFrame('/adGame/edit?id=' +  args);
    },
    Remove: function(_this, args) {
        var _self = this;
        layer.confirm('您确定要删除吗?', {
            btn: ['确定','取消']
        }, function(){
            $.post("/adGame/delete", {'id':args}, function(data){
                if(data.status == 'success') {
                    _this.parents('tr').remove();
                    layer.msg(data.msg, {icon: 1});
                } else {
                    layer.msg(data.msg, {icon: 5});
                }
                return false;
            });
        });
    }
};

$(function(){
    ad_game.bindEvent();
});